

//
//  ZpBaseTableViewController.m
//  WeiBo_OC
//
//  Created by MacBook Pro on 16/5/26.
//  Copyright © 2016年 MacBook Pro. All rights reserved.
//

#import "ZpBaseTableViewController.h"
#import "ZpBaseNavigationController.h"
#import "ZpVisitorLoginView.h"
#import "ZpOAuthController.h"

@interface ZpBaseTableViewController ()
@property (nonatomic, assign) BOOL userLogin;

@end
@implementation ZpBaseTableViewController 



- (void)loadView{
    
    if (self.userAccountViewModel.userAccount) {
        [super loadView];
    }else{
        ZpVisitorLoginView *v = [[ZpVisitorLoginView alloc] initWithFrame:[UIScreen mainScreen].bounds];
        self.view = v;
        v.delegate = self;
        
    }
}
- (void)viewDidLoad{
    [super viewDidLoad];
    
}

- (void)setVisitorLoginViewWithImageName:(NSString *)imageName andContent:(NSString *)content andIsHome:(BOOL)isHome{
    
    if ([self.view isMemberOfClass:[ZpVisitorLoginView class]]) {
        ZpVisitorLoginView *v = (ZpVisitorLoginView *)self.view;
        [v setUISizeWithImageName:imageName andContentLabel:content];
        [v hiddenCircleImage:isHome];
    }
   
    
    
}

#pragma mark - VisitorLoginViewDelegate协议

- (void)willUserLogin{
    NSLog(@"登录");
    ZpOAuthController *OAuthVC = [[ZpOAuthController alloc] init];
    ZpBaseNavigationController *naVC = [[ZpBaseNavigationController alloc] initWithRootViewController:OAuthVC];
    [self presentViewController:naVC animated:YES completion:nil];
}

- (void)willUserRegister{
    NSLog(@"注册");
    ZpOAuthController *OAuthVC = [[ZpOAuthController alloc] init];
    ZpBaseNavigationController *naVC = [[ZpBaseNavigationController alloc] initWithRootViewController:OAuthVC];
    [self presentViewController:naVC animated:YES completion:nil];
}

- (ZpUserAccountViewModel *)userAccountViewModel{
    if (!_userAccountViewModel) {
        _userAccountViewModel = [ZpUserAccountViewModel shareUserAccountViewModel];
    }
    return _userAccountViewModel;
}

@end
